#pragma once
#include <BWAPI.h>
#include <BWTA.h>
#include "EngageTypes.h"
#include "UnitTactics.h"
using namespace BWAPI;

// typedef for easier access
typedef EngageTypes::EngageType EngageType;
typedef UnitTactics::UnitState UnitState;

class EngageManager
{
  public:
    // Class methods
    static EngageManager* create();
    static void destroy();
    void onUnitDestroy(Unit* unit);
    void update();

    // Interface with other managers
    void engage(Unit* unit, Position target, EngageType method=EngageTypes::Attack);
    void engage(std::set<Unit*> units, Position target, EngageType method=EngageTypes::Attack);
    void dismiss(Unit* unit);
    void dismiss(std::set<Unit*> units);

  private:
    EngageManager();
    ~EngageManager();
    std::map<Unit*, UnitState*> states;         // The states of each unit we own
    std::map<UnitType, UnitTactics*> tactics;    // A map from type to an instance to execute tactics
};
extern EngageManager* TheEngageManager; // singleton

